<template>
	<view class="securityCenter">
		<!-- 返回首页 -->
		<uni-bankhome />
		<u-cell-group>
			<u-cell-item title="实名认证" @click="navigateTo('/pages/mine/distribution/auth','auth')"></u-cell-item>
			<u-cell-item v-if="userInfo.paymentPassword" title="修改支付密码"
				@click="navigateTo('/pages/mine/set/securityCenter/editPassword?type=edit','isauth')">
			</u-cell-item>
			<u-cell-item v-if="userInfo.paymentPassword" title="忘记支付密码" @click="navigateTo('/pages/mine/set/securityCenter/forgetPassword','isauth')">
			</u-cell-item>
			<u-cell-item v-if="!userInfo.paymentPassword" title="设置支付密码"
				@click="navigateTo('/pages/mine/set/securityCenter/editPassword?type=setup','isauth')">
			</u-cell-item>
		</u-cell-group>
	</view>
</template>

<script>
	import storage from "@/utils/storage.js"
	export default {
		data() {
			return {
				userInfo: {},
				mobile: "", //存储手机号
			};
		},
		onShow() {
			this.userInfo = storage.getUserInfo()
		},
		methods: {
			navigateTo(url, type) {
				if (type === 'auth') {
					this.userInfo = storage.getUserInfo()
					if (this.userInfo.idCardNumber && this.userInfo.realName) {
						uni.showToast({
							title: '已认证',
							icon: 'none'
						})
						return
					}
				}
				if (type === 'isauth') {
					this.userInfo = storage.getUserInfo()
					// if (!this.userInfo.idCardNumber || !this.userInfo.realName) {
					// 	uni.showToast({
					// 		title: '请先进行实名认证',
					// 		icon: 'none'
					// 	})
					// 	return
					// }
				}
				uni.navigateTo({
					url: url,
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	.securityCenter {
		.u-cell {
			line-height: normal;
		}
	}
</style>
